<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>class类</title>
</head>
<body>
    <script>
        // 手机
        // function Phone (brand, price) {
        //     this.brand = brand;
        //     this.price = price;
        // }
        //
        // // 添加方法
        // Phone.prototype.call = function () {
        //     console.log(`我可以打电话！！`);
        // }
        //
        // // 实例化对象
        // let Huawei = new Phone(`华为`, 5999);
        // Huawei.call();
        // console.log(Huawei);

        // class
        class Phone {
            constructor(brand, price) {
                this.brand = brand;
                this.price = price;
            }

            call() {
                console.log(`我可以打电话！！`);
            }
        }

        let onePlus = new Phone(`1+`, 1999);
        onePlus.call();
        console.log(onePlus);
    </script>
</body>
</html>